package com.aiyige.page.detail.dialog;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.aiyige.MyApp;
import com.aiyige.R;
import com.aiyige.utils.AppCommentUtils;

/**
 * Created by xiachao on 2017/11/9.
 */

public class DialogAppComment extends Activity {

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_app_comment);
        init();
    }

    private void init() {
        try {
// 去鼓励/吐槽
            findViewById(R.id.tv_goto_comment).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    try {
                        Uri uri = Uri.parse("market://details?id=" + MyApp.getInstance().getPackageName());
                        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                        startActivity(Intent.createChooser(intent, "请选择要查看的市场软件"));
                        AppCommentUtils.getInstance().setShowAppCommentDisable();
                        finish();
                    } catch (Exception e) {

                    }

                }
            });
            //以后再说
            findViewById(R.id.tv_comment_next).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    try {
                        AppCommentUtils.getInstance().setNeedShowAppComment(false);
                        finish();
                    } catch (Exception e) {

                    }

                }
            });
            //残忍拒绝
            findViewById(R.id.tv_turn_down_comment).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    try {
                        AppCommentUtils.getInstance().setShowAppCommentDisable();
                        finish();
                    } catch (Exception e) {

                    }

                }
            });
        } catch (Exception e) {

        }

    }

    @Override
    public void onBackPressed() {

    }
}
